title: Add attribute with colon to xml node with FOR XML PATH
body: <p>I am trying to modify a stored proc to contain the following:</p>
  <pre><code>SET @XML = (    
      SELECT Category.Title,
          (       
              SELECT 'true' AS [@json:Array], Book.Name, Book.Value
              FROM @Book Book
              WHERE Category.CategoryID = Book.CategoryID
              FOR XML PATH('Values'), ROOT('Book'), TYPE
          ) 
      FROM @Category Category
      FOR XML PATH('Category'), ROOT('Response')
  ) 
  </code></pre>
  <p>The &quot;SELECT 'true' AS [@json:Array]&quot; is there to force the xml to add &quot;json:Array='true' to the values node so that even if there's only one child element it will be contained in an array.  But, the @json:Array throws an error: &quot;XML name space prefix 'json' declaration is missing for FOR XML column name '@json:Array'.&quot;</p>
  <p>I've looked at links like <a href="https://stackoverflow.com/questions/1051362/help-with-for-xml-path-escaping-special-characters">this</a> but they all seem to deal with adding attributes that don't include a colon.  I've also tried adding &quot;WITH NAMESPACES...&quot; but couldn't get the syntax right.</p>
  <p>Can someone tell me how to modify the SQL to have this work?</p>