SQL/XML XMLCONCAT in some instances can be used a as workaround to do a lob concat, but it's not applicable here since we're dealing with the xml declaration construct. So the only available workaround would be to use a stylesheet, which is admittedly a bit cumbersome, but will add the xml declaration:
{code:sql}XMLPARSE(DOCUMENT XSLTRANSFORM(doc, '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="iso-8859-1"/> <xsl:template match="/"><xsl:copy-of select="/"/></xsl:template></xsl:stylesheet>' ) WELLFORMED){code}
Where doc is your constructed doc/element, i.e. SELECT XMLPARSE(DOCUMENT XSLTRANSFORM(XMLELEMENT ...
This will make your procedure dependent on the environment that it is deployed in. We'll note this workaround in the Teiid/Teiid Designer issues, but I think that we should have something a little more built-in.
For at least this example you could do all of your transformation in just a stylesheet, but you would have the concern that the input document cannot be too large as the stylesheet logic currently uses a dom model and not streaming.