You're gonna need the namespace.
Play around with this:
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
<PropertyGroup>
<!-- Always declare some kind of "base directory" and then work off of that in the majority of cases -->
<WorkingCheckout>.</WorkingCheckout>
</PropertyGroup>
<Target Name="AllTargetsWrapped">
<CallTarget Targets="ReadXmlPeekValue" />
</Target>
<Target Name="ReadXmlPeekValue">
<ItemGroup>
<MyNamespaces Include="peanut">
<Prefix>peanut</Prefix>
<Uri>http://schemas.microsoft.com/powershell/2004/04</Uri>
</MyNamespaces>
</ItemGroup>
<!-- ReadElementText -->
<MSBuild.ExtensionPack.Xml.XmlFile TaskAction="ReadElementText" File="$(WorkingCheckout)\Parameters.xml"
Namespaces="@(MyNamespaces)" XPath="//peanut:Objs/peanut:Obj/peanut:MS/peanut:S[@N='Password']">
<Output PropertyName="MyValue1" TaskParameter="Value"/>
</MSBuild.ExtensionPack.Xml.XmlFile>
<Message Text="MyValue1 = $(MyValue1)"/>
</Target>
Output:
Target AllTargetsWrapped:
Target ReadXmlPeekValue:
XmlFile: .\Parameters.xml
Read Element: //peanut:Objs/peanut:Obj/peanut:MS/peanut:S[@N='Password']
MyValue1 = some password text
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.07