Verify the XML that you are opening contains "<?mso application=”Infopath.Document”>". If does not you can insert it.
If you have it in the XML and stil think that InfoPath is removing it, you can add the PI in the code. Here is the code to do it,
string sAttachmentPI = "mso application='Infopath.Document'";
string sDomXML = thisXDocument.DOM.xml;
if(-1 < sDomXML.IndexOf(sAttachmentPI))
{
return;
}
IXMLDOMDocument2 oTempDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();
IXMLDOMProcessingInstruction oAttacmentPINode = oTempDom.createProcessingInstruction(sAttachmentPI, "");
IXMLDOMNode oRootNode = getNode("/rootNodeT");
oRootNode.parentNode.insertBefore(oAttacmentPINode, oRootNode);