First line of defense in bear country is a proper electric fence.
Secondary precautions could be to strap hives down securely so bears that might come through the fence have trouble getting to the brood comb. (That is what they are after)
You could add security lights which come on when a large animal moves near the apiary.
Finally, if you have a problem bear who will bull their way through other precautions...a firearm.
Such a bear is dangerous.
You might fire in the ground one time to scare such a bear off.
If that doesn't work, you should use lethal force. Never ever, ever, ever, shoot to wound a bear!!!!!
If you wound a bear you are being inhumane to the bear.
In addition that bear is now a threat to you and anyone else it comes in contact with. It could charge a neighbor down the road the next day.
Before such an encounter, talk with your local game warden. Discuss the fact that you have taken reasonable precautions to prevent this bear from destroying your private property and killing your livestock. (Your colonies of bees are considered livestock) I know 2 beekeepers in my area who were told that if they have to shoot and kill a bear, to leave the bear where it lies and call the warden. Our local authorities understand the issue.
If you must shoot a bear, what should you use? Do not use buckshot. Do not use Walmart special slugs. These rounds are not designed to put a bear down. If you have a highpower rifle, use it with a heavy grain round. If you must use a 12 gauge shotgun, order Brennekke black magic slugs. They are built to punch through the thick bone of a bear and drop them quickly. The skin of a bear isn't the problem. It's the hard bone covered in thick fat. Practice shooting many times so that you are accurate.