As I've said before, a rejection of your work—no matter how strongly you identify with it or believe it to be an extension of yourself—is just that: a rejection of your work. It's not an indictment of your character, it's not a dismissal of your accomplishments or promise as an artist, it's not a personal attack. All it means is that the agent or editor in question doesn't want to represent you or pay you based on the work you've created. That's it.
That said: rejection still sucks. Nobody wants to be told something he/she created isn't wanted, especially if he/she spent years crafting it. It can be especially upsetting if one gets relentless form rejections, or (though slightly more encouraging) receives a few partial requests but no invitations to submit the full ms.
The truth is, however, that just as discipline and talent are necessary (though not sufficient) conditions for success as a writer, so, too, is perseverance. Refusing to quit in and of itself won't necessarily get your work published, but without it, you'll be steamrolled over by the inevitable rejections and will never get your writing to the right agent or editor.
Be prepared to get rejected hundreds—if not thousands—of times. Understand that this business is exceptionally susceptible to bias and subjective/individual taste, meaning that simply because your work is rejected, that doesn't mean it isn't good. Remember that a lot of people who are/were much better writers than you were/have been rejected a lot more than you have been. Finally, keep in mind that there are some people who for whatever reason—celebrity, better connections, more money, &c—will have a leg up on you that has nothing to do with their (or your) writing, and you need to be writing as well as possible and submitting your work as persistently as you can in order to partially offset this imbalance.
Stupid? Yes. But, to quote Bender "Bending" Rodriguez, the truth is often stupid.
If anyone has any particularly good methods for dealing with rejection, please post them in the comments—as for me, I find that pinning up the personalized/tiered rejections is encouraging, and the form rejections can make pretty good art projects. In all seriousness, though, I read the rejection, have a snack/drink/nap, and get right back to writing and submitting. What else is there to do?
