So here's the dirty little secret of Guild Wars 2 - targeting enemies is mostly a formality. The majority of your attacks work equally well with or without a target.
What this means in practice, is that whether or not you're being targeted is irrelevant. Are you in the path of the projectile, standing in the fire, or within the weapon attack cone of the mob? (Hint: If the Ogre raises his hands up, get out from in front of him!)
Which brings us to how to dodge.
Avoidance
Strafing is only effective on non-homing projectiles. Some home, some do not. Off the top of my head, the Guardian skill "Orb of Light" does not home, and can be dodged via strafing, while their "Ray of Judgement" Skill does, and cannot. Most mobs, however, can always be dodged by strafing.
Shadow-stepping technically falls into this category, as it is (usually) just a simple displacement. Most of the time, getting out of the path of the arrow will, in fact, dodge the arrow.
Line of Sight
Entering stealth does not inherently protect you from fired attacks, unless the same skill that granted stealth also granted you evade. (More on that a little below) If you're standing in front of the ogre, the ogre will still hit you, even if he can't see you.
For projectiles, you have another option; simply stand behind something. Projectiles which must pass through part of the world to get to you (such as the corner of a mountain, or particularly thick trees) will show up "Obstructed", and deal no damage.
Dodge Rolls
Dodge Rolls (by default, bound to double-tapping one of the movement keys) allow you to evade otherwise "Homing" projectiles. You'll still be "hit", but instead of damage or conditions, the message "Evaded" will pop up. You can even dodge through damaging zones this way, and not take any damage.
You may notice that some skills grant "Evasion", such as the Ranger's Shortbow 3. Abilities that grant "Evasion" are exactly like performing a dodge roll in terms of avoiding damage (though they will not consume endurance nor trigger dodge roll specific traits). Usually, they are accompanied by movement in a specific direction, though this is not always backwards.
Skill-Based
There are also a couple of skills that let you "Block" attacks, negating any damage or applied conditions. These skills often have additional effects that trigger (or can be triggered) if the block is not consumed. Additionally, the Guardian Buff, Aegis, allows you to block one attack. Some abilities refer to "Absorb", which is the same as block.
Projectiles also have a special counter -- certain skills can "reflect" them. This is about what it sounds like, with attacks being returned to their source.
Finally, there are a few skills that grant flat out "Immunity", such as the Elementalist's "Obsidian Skin". These will prevent damage and conditions, but will not move you. The Mesmer additionally has the "Distortion" buff which is identical, except for the name.
Conditional Defense
Lastly, there are a couple of conditions that can prevent damage. Blindness causes the next outgoing attack to miss (though it has reduced efficacy on bosses).
The other potential conditions are Daze and Stun. Daze interrupts all spells and attacks and locks them out for 3 seconds, while Stun interrupts and prevents all actions, including movement (though it's a little harder to get access to). A necromancer's fear can serve as an interrupt also.