How can I position the element generated by XMLTEXT in a FOR XML query?
After some more fiddling, I found out that there is an XML directive which does the job (if I omit the attribute name, test): 

SELECT
  1    AS Tag,
  NULL AS Parent,
  id   AS [entry!1!id!ELEMENT],
  '&lt;test type="dummy" /&gt;'
       AS [entry!1!!XML]
  FROM #temp
  FOR XML EXPLICIT;


This produces the results I want:

&lt;entry&gt;&lt;id&gt;1&lt;/id&gt;&lt;test type="dummy" /&gt;&lt;/entry&gt;


(demo)

This directive is mentioned briefly here but I couldn't find more documentation or any examples.