Skeletons are a good example of this, as their brittle bones can be weak to bashing damage. However, they are resistant to arrows, since there isn't much for an arrow to stick into. Use your sense when you come up against a monster that seems to be resistant to a certain type of damage. The monster may be vulnerable to an opposite damage, or to silver or magical weapons. If the guards are attacking you, it is because they see you as evil.
Chances are that they are correct.
If you have killed shopkeepers, good townsfolk, or other characters, you probably have an evil reputation. Wearing or using magic items may change your reputation, depending on what the items are. The safest bet is to check your reputation after putting on an item that you have not had Identified. I keep getting messages saying my character sneezed. If your character is sneezing, coughing or has a runny nose, then you have been diseased.