There are some XML databases that have a XQuery sandbox or IDE integrated. BaseX is a great example (see christians answer).
Another remarkable tool is eXist-db's eXide IDE. The version I'm linking to here lets you run queries from any browser, though for security reasons you can't upload files to their server. To use eXide on your own XML files, you can install eXist locally (it's quite easy), and then you can create or import XML files and test your XQueries on them.
Finally, there's Zorba's sandbox, offering some example queries and XML files.