One-by-one, you can't. You're at your desk, sales calls and says excitedly that they've set up another meeting with Mr Big, and are you free at 2? And can you make another demo by then? It's just never going to be an appropriate response for you to say "dude, Mr Big is totally not buying this software, that meeting would waste my time, no, I'm not going." Whether Mr Big is buying or not is something the sales guy is supposed to know more about than you. (In fact, he might even be right.) So for that call, you have to suck it up and say sure. And do a good job on the slides!
Longer term, a chat with your boss about this "supporting the sales team" role would probably be helpful. Is your issue the time spent? Or that you object to investing time in something that is doomed? In my experience, it is highly unusual for the number of technical people in the room to shrink as the sales process goes on - normally the tech people only show up once things are getting warm, and more of them come to each meeting until the client is landed. So you wanting to bail from the process before the sale is closed will appear strange to management and sales. Discussing this with management may help you to understand how your presence increases the chance of a sale. I think it's unlikely management will grant you a pass to bail on selected client pitches based on your opinion of whether they are going to buy or not, but you could talk about it.
Finally, you clearly are expected to produce slides and demos as part of your job, so approach them with the same dignity as "real code". Reuse, have a repository, be modular, don't repeat yourself, figure out how to waste as little time as possible giving sales what they need. Remember, when Mr Big does write that cheque, he's funding your salary. You want him to buy. You want to help sales. You just want to do so as quickly and efficiently as possible.