Understand your exits. From your desk, the coffee machine, copier, bathroom, etc.
Know the shortest path, or the path with most cover.
If you sit in view of an exit or elevator, keep an eye on it. Pay attention to who comes in and out.
Think about what is between you and the exits/entrance. If a bad actor enters your room or floor, what will he/she see first? What is between you? If a bad actor is present, keep thing between you, and increase the distance as much as possible. Stay down, stay dynamic. Don't get under a desk and freeze. Be prepared to move if needed.
If you can get a license/permit to carry a gun and are comfortable with it, get one and train with your firearm regularly. Shooting is a skill you will lose if you don't keep it sharp. If your office will not permit you to carry, then get a trusty pocket knife. This is not for offensive strikes. This is to be used in defense when trying to exit and flee.
Regardless as to what kind of weapon you have/make, do not take the fight to the bad actor. These are to ensure your exit. This isn't the Wild West; avoid a shoot out at all cost.
When the police show up, DO NOT have a weapon in your hand. Drop it. Move away from it slowly and with your hands up. If you are still in danger, drop it and leave it. You can try to obtain it later once the dust settles.
At the end of the day, it's not about having a weapon, it's about being vigilant. Be aware of who is around you and what they are doing. Know who belongs on your floor/in your office/around your building. If you see something, say something. Always be aware of your surroundings and who is paying attention to you.