Keep alert and avoid what you perceive to be sketchy groups of people. That's the best advice I've got.
Back in my courier days, I got jacked for my gear once. (Bike was too big for the kid who took me down and it was about a block away on the sidewalk after I came to. Bag was long gone, though.)
At the time, I rode with the heavy end of a pool cue in a velcro holster on my top tube, ready for a quick draw... but when you get clubbed with a section of lumber by a kid who pops out from between a couple of parked cars, there's no time to react. Any weapon you're carrying just ends up being something else which can be used against you in a situation like that.
__________________
"I feel like my world was classier before I found cyclocross."
- Mandi M.