Workaround:Specify fully qualified OBJECTID name (ARCIMS.ARCIMS.HOSPITALS.OBJECTID) instead of #ID# in the subfields attribute for the SPATIALQUERY element. I am not sure if this should be a requirement as the ArcXML Programmer's Reference Guide specifically mentions #ID# for queries to work, not the fully qualified layer/attribute name.