There pretty much always is something you could have done better to avoid a death.
Often players take a little bit (or large amount) of risk which opens up the possibility of dying, in order to save time or gain rewards. Warping straight from gate to gate saves you time and effort, until you warp into smartbombs. Taking that one relic site in null while hostiles are in local may reward you with ISK, but if you checked their names and noticed one of them likes camping exploration sites to kill explorers you could have made a better choice for survival.
If all else fails, don’t undock and you simply cannot die from a mistake.