You know what the referee said in the part of the review meant to be seen by the authors, and you know that the paper was rejected. You don't have necessarily have access to all the communication between the editor and the referee.
In particular, there are often check boxes for the referee indicating how she or he ranks the importance of the topic of the paper, the relevance of the topic with respect to the journal and the readership, and the priority for publication.
You also don't necessarily know what's already in the hopper for this journal. They might have a backlog of extremely high quality papers, and are only accepting the best of the best. There are certainly enough papers that receive good reviews that don't get published -- just like there are tons of good grants that don't get funded.
So, there's a chance that your paper was an excellent paper, and just not a high priority for that particular journal at this particular time.
There's also the possibility that the referee is right about how applicable the work of Mr. X is, and you just don't see it. (No offense meant -- all we know about you are your initials, and that you say you've had a paper rejected). Maybe what the referee is trying to say is that Mr. X's work is solid enough, and even though you have a new approach, the conclusions drawn are similar enough that a revisit isn't high enough priority for publication in that journal. We have no way of knowing. If you feel this isn't on the mark, when you resubmit elsewhere, be sure to include the work of Mr. X in your discussion, and show the reader why your work is different from that work, and why your current efforts are important to consider.
The best advice I can offer is to depersonalize the process. You'll hear a lot of stuff during peer review, and it's real easy to let it get to you. Don't let it get to you. With experience, you'll learn what your referee pool wants to see, and you'll give it to them, and have an easier time pushing your papers through.