[FIX] XQuery, GH-657: Better detection for undefined variables.
Merge pull request #668 from LeoWoerteler/gh-657

[FIX] XQuery, GH-657: Better detection for undefined variables.