The first test carried out in a normal melee or ranged attack is for a miss. (A target that is not standing is automatically critically hit. “Normal melee or ranged attack” means the target is standing.)
The difference between the attacker’s Attack Rating and the defender’s Defense determines the chance to miss a melee or ranged attack. When a player or mob attacks a player, the chance is a base 5% plus 0.04% per rating difference. Level is not a factor except when attacking a mob level 9 or lower. Miss chance against a low-level mob is a percentage of normal equal to the mob’s level divided by 10. When a player or other mob attacks a mob, the change in miss chance is 0.2% per rating difference if that rating difference is 11 or more. If the rating difference is 10 or less then the change in miss chance is 0.1% per point. If the attacker and defender have the same ratings then of course the total miss chance will be 5%.
Dual-wielding used to be a special case. The chance to miss on each weapon was 80% times the chance calculated above, plus 20%. If a miss chance calculated as above came out to 5% then dual-wielding increased this miss chance to 24% (which was 80% * 5% + 20%) for each weapon. A 10% miss chance with one weapon would have become a 28% chance for each dual-wielded weapon, and so on. WoW was patched to change this formula to a flat rate of +19% miss chance when dual-wielding. For the common base miss chance of 5% the result is still 24% but now instead of 28% on a base miss chance of 10% the miss rate goes to 29% for a 10% base (which is of course 10% + 19%).