To answer the question may take a bit of long-winded explanation but the simplest answer is that yes, they can die.
What exactly kills a transformersTransformer is based upon what continuity they are in. forFor example in most continuities, extinguishing the spark is the only sure way to kill one ( ie. rampage being stabbed in the heart in beast wars, lockdown dying in a similar fashion in age of extinction, optimus being stabbed through the chest in RoTF, the autobots aboard the shuttle all being shot in the chest repeatedly in the original 80s movie)i.e.:
- Rampage being stabbed in the heart in Beast Wars,
- Lockdown dying in a similar fashion in Age of Extinction,
- Optimus being stabbed through the chest in RoTF,
- the Autobots aboard the shuttle all being shot in the chest repeatedly in the original 80s movie.
However, in IDW continuity rossum'sRossum's trio is a series of interconnected organs in which damage to the brain or transformation cog can also cause death. There are anomalies in all of these however, such as starscream'sStarscream's ghost in G1, rampageRampage in beast warsBeast Wars not requiring energon to live, and the primesPrimes in the movie continuity living on despite their physical bodies being lifeless husks in egyptEgypt.