By buying one? You buy a clone and it makes a copy of your current character and stores it in a vat on a space station of your choosing. So, if you know you're going into a battle where death is more likely than not, simply get a clone ready and you lose nothing.
There is also insurance, so you can get an insurance on your ship to coup some of the losses back. At least I seem to recall there being one, it's been awhile.
Oh and one more thing, losing your ship doesn't mean you automatically die. You leave in an escape pod and in large battles, going after an escape pod isn't something that's really done unless the enemy wants to grief you. If you're just out doing missions for money, I don't think NPC enemies kill pods.
There is also different security levels in sectors. You can get your feet wet in high sec systems and just run missions against NPCs if you want to. You don't *have* to start the game and fly into the wild west from the get go. In high sec you are relatively safe as most people can't be arsed killing newbies there because the po-po will kill them if they do and your ship isn't worth the trouble.
Your thought is correct NPC's don't PK