How to blow off a guy nicely?

say I am at a party and a guy comes up to me to talk (even though I'm sitting with friends) and I'm not interested in him. What is the nicest and most polite way to avoid him and show I'm not interested?

I kept up the convo and eventually some guy he knew passed by so I took the chance to leave while he was distracted.
How to blow off a guy nicely?
Post Opinion