L.M.
My daughter, who is almost 7, says that too...mostly when she's in trouble as well. I am only guessing it's a "defense mechanism"...a way to try and get pity, perhaps to get out of trouble.
You need to make him aware that it is his ACTION, not HIM, that got him in trouble. You also need to "catch him" being good...give him praise (maybe more than usual), perhaps small treats for things you catch him doing right, extra hugs and kisses.
Also, sit down with him and ask him if he really knows what being dead is, or wanting to die. Tell him that you would miss him terribly and all the other things that would happen were he not around.
Also, you need to wonder where this is coming from....he's getting something from school probably (this is around the time my daughter started that too - kindergarten).