title: XML: A namespace prefix is claimed to be not declared when it fact it is
body: <p>We've got a web service that returns a very simple XML.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;t:RequestResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://our.website.com/ns/" xmlns:t="http://our.website.com/ns/"&gt;
    &lt;t:Result&gt;No candy for you today.&lt;/t:Result&gt;
    &lt;t:Success&gt;false&lt;/t:Success&gt;
  &lt;/t:RequestResult&gt;
  </code></pre>
  
  <p>The caller gets this XML no problem, using XMLHTTP.
  But XPath queries don't work agains this XML because of <strong>"Reference to undeclared namespace prefix: 't'"</strong></p>
  
  <p><strong>Why so? I'd say the 't' prefix is somewhat declared.</strong>
  Is this document invalid in any way?</p>
  
  <p>In case you wonder why we had to <a href="http://social.msdn.microsoft.com/forums/en/asmxandxml/thread/77aa3fb0-6b8a-4dc4-9308-0dcd5184c287/" rel="nofollow noreferrer">use XmlNamespaceDeclarations to add namespace prefixes</a> in the first place, that is because otherwise the resulting document cannod be queried upon becase it has a target namespace but hasn't got a prefix for it, so XPath ignores node names because they don't belong to requested (empty) namespace, and we don't wan't to use constructions like <code>"//*[namespace-uri()='http://our.website.com/ns' and local-name()='RequestResult']"</code>.</p>