I usually use pub.xml:queryXMLNode to extract a node and then use a branch statement to determine whether the extracted node is null. If it is null, I deal with the error or if not, I convert it to a document for processing.
One way to determine your query is to trace through your service to your queryXMLNode service and then click on the “variables” tab to see the structure of the document. You can right-click on a node in the document and create a new variable with the query string. Just remove the /text() from the end and set the variable type to object. See the Built-In Services Guide for information on how to use queryXMLNode.
The XML Services Developer’s Guide has some information about XQL as well as the URL for the XQL spec. Also, there are several XQL-related posts here in the discussion forums.