Second, he or she may not know what I'm hoping to achieve with my workout. Once, when I was nursing an injured knee back to health, a gym employee came over and increased the incline on my treadmill without asking, thinking she was helping my workout when I was just trying to get my endurance back without re-injuring myself. And finally (and slightly indignantly), if I want help, I'll ask!
After the break, three suggestions and potential outcomes on different ways to handle that friendly-but-unsolicited "advice."
Response 1: Smile Politely
This is how I usually handle getting advice I don't want to hear, however helpful. I smile politely, and then direct my attention back to working out. Most people get the hint.
Response 2: Thanks, but no thanks
I'm nonconfrontational, but have daydreamed about retorting with an, "Actually . . . I'm training for something specific," and completely shutting the advice-giver down. But it's also fine to say, "I appreciate your advice, but I'm OK, thanks."
Response 3: Ignore
Keep your headphones in, stare straight ahead, and pay no attention. They'll get the point.
A notable exception
If a gym staffer corrects your form for safety purposes, the above don't apply. For example, if you're struggling through a set of crunches with poor form, save yourself tomorrow's backache and listen to their suggestions.
When to ask for help
If the "advice" is ever malicious, makes you uncomfortable, or is just plain rude, enlist the help of a gym staff member. It's not worth getting upset about, and it's certainly not worth getting angry about.
Have you had to deal with something like this? How did you handle it? Did it work out?