The milder approach:
I'm not comfortable talking about that.
This makes it about you -- no criticism of the other person. My religion has prohibitions on many types of gossip, and this is what I usually say to disengage.
A slightly stronger approach, suggested by elrobis, is:
Eh, it's not really my business.
That's still about you (you don't want to pry) but can carry a tiny hint of rebuke with it if it's really not the other person's business either. Decide on a case-by-case basis if that's an advantage or a disadvantage.
The stronger approach, for use if the previous doesn't work or this happens a lot with this particular speaker:
I'm not comfortable hearing gossip about other people. It makes it harder for me to treat them neutrally. (Or some other short explanation if you prefer.) Let's talk about something else.
As some other answers said, naming it -- "gossip" -- might get through in a way that just changing the subject or avoiding the problem might not. If this is somebody who, if asked "is it ok to gossip about people behind their backs?" would say "no", then you're helping him to recognize that he's doing something he doesn't want to do. If he would say "yeah, so what?" then naming it probably won't help, but it'll at least make it clear how you view the conversation.