Fixed issue where setting include_namespaces to False raised exceptions when calling to_xml()