• Which version of SQL Server are you using? If you are on SQL Server 2005 or above, you can use WITH XMLNAMESPACES() to generate an XML document with namespace information.

    if you need CDATA sections, you need to use EXPLICIT.

    .