1. Always keep your eye on whats coming up and know your area in case you need to alter your course.
2. Be sure someone at work that you trust knows that you commute by bike and what your typical route is. Just in case something does happen you have someone that can give an idea where you ride.
3. Make sure you can get off the bike and away quickly if for some reason you need to. If you have clipless pedals then wear the MTB type of shoe so you can walk or run. As we all know road shoes are a pain to walk in.
As for a weapon. Anything that you can pull out can be used against you. So if you insist on carrying something be sure you know how to use it and defend against it.
Pepper spray is good and all but has a tendency to spray back into the users face due to wind. Most of the time you have to be right up close and personal to make it effective.
Keep in mind if you take the ability to See, Walk or breathe away from the attacker, you can get away.