In encounters, try to stay away from areas that are direct routes between popular areas. For instance Boneyard is dangerous. Also try to spend as little time in encounters as possible, the longer you're in there the more likely you are to be encountered by another player.
In unguarded towns, drop everything at a tent and scout it real quick before you bring anything valuable in (for trading, etc).
To prevent stealing, just don't let other players touch you. Keep away from them, and move as quickly as possible if needed. Keep caps or other things in hand slots. If you're trading, use the esc key to exit the window if someone else comes in, it's faster.
All that being said, you won't be able to avoid PvP completely, so if attacked fight back.