OpenXML: XML parsing error: Reference to undeclared namespace prefix:

I ran into a small issue using an XML document type in SQL 2005 from BizTalk 2006 R2 and it turn our to be a namespace pass in from the sp_xml_preparedocument statement in my stored procedure.

You need to set it up as follows:
EXECUTE sp_xml_preparedocument @idoc OUTPUT, @xmlMessage, ‘<root xmlns:ns1=”http://namespacename” />’

The ‘<root xmlns:ns1=”http://namespacename” />’ being the most important part as this defines the namespace from the first part of your message.

Then your OPENXML call can be set up using the namespace – i.e /ns1:<node> etc.