The issue can be reproduced using the same setup as FeatureGML32Test (gs-app-schema-test module), but the backing datastore must be a database (I'm testing on PostGIS).
Create the following stored query:
The StoredQuery is created correctly, but the following GetFeature request returns nothing:
The same query returns one result if used on its own (i.e. without encapsulating it in a StoredQuery).
Apparently, the issue has to do with the XPath expression not being resolved properly, due to missing namespace definitions in the XML parser's context.