I think stun guns are ineffective... You have to actually press it against somebody which means you get within lethal range of whatever weapon your assailant is holding (a knife, a club, etc.).
What vietho26 mentioned is actually a Taser gun, which shoots out two darts with wires trailing out behind it, and shocks your target from a relatively safe distance of 16 feet or so. The biggest problem with the Taser gun is that its projectiles are air-driven (like a beebee gun), which means it is not very accurate. If you don't hit on your first and only shot, you are dead meat.
I don't know if they are legally available to anyone but law enforcement officers though.
The best defense? Be street-smart. Don't go out at very late hours alone, always walk in well-lit areas, give suspicious-looking people a wide berth, always be alert and aware of your surroundings, and stay on the balls of your feet, never carry too much cash. A self-defense class helps too.
I always carry my credit cards and IDs in one of those neck lanyards tucked under my coat so if somebody mugs me for my wallet, all he gets is my cash and nothing else. I also plant a few of those faux-credit cards you get in the junk mail from Discover or Bank One as decoys in my wallet.
And if you are really paranoid, you can change your routines every day-- Walk a slightly different path, vary the time. Sometimes muggers see the same person walk the same route at the same time of day every day, they might be tempted to jump you for quick cash.
Unless you have had extensive firearms training, it's probably not a good idea to carry a gun and chance having it turned against you by your assailant. I'd sure love to learn to shoot like our fellow dentist Doc Holliday though.
Just my experience having lived in some of the rougher neighborhoods in NYC for years.. And survived.
For the record: This would be my preferred concealable weapon for self-defense:
That's the German-made Heckler & Koch MP5K submachine gun, which can be fired from inside its specially-designed briefcase (!).