invasion

Someone entered the game while i was with a friend and he killed us both. Is there a way to block invasions?