It's a self-fulfilled statement predicated on the stagnation of our two party system. If people will either not vote or buy into the non-viability of third parties, then third parties will never aggregate the votes necessary to win. So long as you repeat the mantra, it is true. If you hold your nose and say "I'm voting for the lesser of two evils" every time, then of course third parties won't win.
But the insane part is this belief that voting for the lesser of two evils over and over and over again will benefit us. When was the last time the main party gave us a choice that wasn't an evil? So we ratchet down every cycle, while people believe that voting third party is a waste of a vote. Not because it actually is, but because enough people have convinced themselves that it is.
What you end up with is what we have now, a one party system trying its best to look like it's two. Because there is no true political competition. The R's and the D's know they aren't actually going to lose power, they just teeter-totter control back and forth. In the end, all the major stuff is the same. The status quo is the same on both sides of the isle. And that's what we will get time and time again. Look even now. Trump and Sanders are party outsiders and the GOP and DNC are doing everything they can to try to stop them. They want someone more controllable, one who will toe the party line better. And then we'll be presented once again with a "lesser of two evils" (not that I like Trump or SaSanders all that much, it's just that those two make the main party's intentions super clear).
The lesser of two evils is still evil. It's not sustainable. Perchance if you had a lesser of two evils rarely, it could be stomached, but every time? No, the system breaks.
So if you're like me and you cannot stand the actions of the Republocrats and the direction that the Republic is going, what are you to do? Not vote? The Republocrats win. Hold your nose and vote for the lesser of two evils? The Republocrats win. The only option left is to vote third party. It's a long shot, but it's the only one with a non-zero probability of making change.
Furthermore, to affect the system, the third parties don't even have to win. All you have to do is unbalance the teeter-totter. If you take enough votes from one side such that they cannot win, they have no other choice than to try to put up candidates that can recapture those lost votes. You're not going to change the party from the inside, this election cycle proves that. You can only deviate the line of motion with outside force.
So "voting third party is wasting your vote" is only true so long as we remain short sighted and believe it ourselves. Furthermore, if you are unhappy with the status quo and the Corporate capitalist model we run now, you have no choice but to vote third party. Supporting the status quo will not change the status quo.