I only ever use notepad or notepad++ to edit XML's - too many other things add unwanted/unprintable characters in my experience.
The problem could be that you're asking a little bit too much of the LANDesk query tool. The issue is that the query tool tries and make "something complex look simple" ... which it does reasonably well.
The problem with this is is that this becomes rather problematic for complex queries. For instance, in SQL your query would be quite straight forward with a
select stuff from table where patchname NOT IN ('Patch1', 'Patch2', 'Patch3') AND detected='1'
and so on (if you allow the pseudo-SQL. Now, because we try to do something complex look simple, your actual SQL query will be a LOT trickier, with countless AND statements. And my experience is that too many AND-statements kill off any kind of code (be it SQL or programming) ...
So what you COULD do is to actually hack the SQL for the query straight into the database (if you're brave/good enough for this). Problem with that is that you need to make sure that no one saves/overwrites your query, as this would over-write your "revised" SQL with the default LANdesk SQL and you'd be back to square one.
But if this is an option you're willing to look at, I can give you the table/columns to look at.
Paul Hoffmann
LANDesk EMEA Technical Lead