In the past you have given the following advice:
1) "It's not a waste of time if you query me, even if it's not right for me" (see: http://jetreidliterary.blogspot.com/2010/05/youre-not-wasting-my-time.html). Elsewhere on your blog, you've said that you'd rather see a query that's not right for you than miss out the chance to represent an awesome novel--or words to that effect.
2) Do your research. If you query an agent with a genre s/he doesn't represent, that shows you haven't done your homework. (I can't cite you on this, but I know I've read it more than once.) (1)
Now, I'm picking on you, but I've seen other agents say similar things. In your humble opinion, as QOTKU, which piece of advice trumps the other? :)
(1) Not from me you haven't.
There's even a Rule for Writers about querying widely.
The longer I'm in this business the more I believe that persistence is the key to success. Not crazy persistence - you want to learn from each experience, not blindly repeat it - but measured, steady persistence.
And who cares if you've done your homework? This isn't Miss Anthrope's English class. This isn't going on your permanent record. So what if you query me for a picture book? The very worst thing that's going to happen is I answer you with a form rejection. If that sends you in to a tizzy, you need a new line of work. If that sends me into a tizzy on Twitter, well, I just needed to vent and now that Brooks Sherman has escaped my clutches, I vent to you not him.
That said, there is something to the idea that you should only query agents you're actually willing to work with, which presupposes you've done some kind of homework on them, or met them at a conference, or have friends who are repped by the agent.
Increasingly though, I'm less patient with my colleagues who behave as though writers are intruding on them by querying, or by querying for the wrong category or something they don't rep. Writers are not beggars. We aren't more stressed or more busy than any of them. There are enough things we have to ask of queriers (no attachments, no phone calls, write an enticing query) that adding more hoops seems both unnecessary and a bit patronizing.
Query widely and damn anyone who says different.