Just say you got a binding on a field in Infopath and you want to remove it. Here is how you can do it:
XPathNodeIterator statusDelete = xnMyForm.Select("/my:myFields/my:statusField", ns);
int count = statusDelete.Count;
if (statusDelete.Count > 0)
{
XPathNavigator delStatusDelete = xnMyForm.SelectSingleNode("/my:myFields/my:statusField", ns);
delStatusDelete.DeleteSelf();
}
I simply use XPathNodeIterator, pick the field i want to remove, check if it exists und delete the first version of it. Because I can't use .DeleteSelf() I have to use XPatchNavigator for this part.