PVP server: Characters are allways PVP flagged and usually you can be attacked at any time anywhere (well, except in instances ofc)
PVE: You have to enter a PVP flagged zone, enter enemie territory/ capital, enter a warzone or flag yourself as PVP in able to PVP. for the rest you are safe to quest, gather, loiter, etc.
RP Servers: Rpíng mandatory during PVE/ PVP