Recently, two different people have told me they were all excited about a revolutionary new idea, went to the literature to read about it, and found someone had already invented it.
I said: "Great!"
They said: "Great?"
I say "great!" for several reasons:
1) You clearly had a great idea if somebody else already came up with it.
2) You are capable of lots and lots of great ideas and will have more
2.1) People who only have one great idea usually have very dull careers following their accolade.
3) At least you didn't spend five years building something you were hoping to patent only to find out it exists and is currently being sold in three countries.
In my area of research, I am always delighted to learn somebody has studied one of my ideas, particularly if they've done a satisfactory job of exploring it, because it means I can spend time more working on other ideas.
Anyway, I'm sure there is some good research-zen koan for this one. Maybe... hold each idea in your hand like a grain of sand, cling too tightly and someone else will patent it.