In InfoPath 2007, it would be something like this:
XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field1", NamespaceManager);
string nodeValue = node.Value;
substituting the "/my:myFields/my:field1" part with the actual XPath of the field you are accessing.