Trespassing is done when you go on a personal claim, town claim or a realm claim.
You only lose alignment when someone spots you and uses the Trespassers! ability when your on a personal claim.
You don't lose alignment in a town claim or a realm claim.
When attacking a marked player you don't lose alignment.