Yes, you are right - this is not a good conversation (or even a monologue) to have in workplace on a regular basis. I'm not against an occasional joke, but when the "joke" part goes aside and things become a "regular" , it starts creating problem.
It's not only about the person them-self, it's about the work environment being filled with negative vibes. Ignoring it may be a short-term solution but will not carry out any positive outcome in long run. The best way to counter this is to talk.
Just open up a friendly conversation (maybe over a cup of coffee in the break-out lounge), saying: (emphasis intended)
Hey Jon Doe, there's something I like to talk to you about. We all have heard you mentioning something about how tough the life is, and I don't necessary disagree about the fact. However, the way you mention it, it does not do anything positive, you see. I, for one, feel that this brings more negativity into the folks around. Sure, I know, that's not your intent, but even unknowingly, these comments / statements come off as a negative thought-provoking idea. We never know who among us is actually suffering from some serious issues with their life (apart from office work) and we never know how your comments are going to affect them. We certainly don't want to be in a position where even by chance, we demoralize them even more by these comments and God forbid they take some wrong steps. So, I'd request you to re-consider the statements you make because we never know how it is going to affect others around you. Hope you get the point.
This should serve as a eye-opener for them, and there's a "subtle hint" that they might be in trouble in case something goes wrong ("negative influence"). I believe that should do the job and they should refrain from making those type of comments in public.
However, there is a (however lower) possibility that they would ignore this - in that case, I believe a chat (not a complain, yet) with the HR would be needed. There are already so much stress - you don't need someone to add to that by making negative and demoralizing comments. Sure, it may be "funny" and "humorous" to some, but if it affects even a few people in an adverse way - it's in everyone's best interest to stop this.
Just a personal note:
Sometimes back, in my team, I had a junior dev who occasionally used to say things (though not publicly, usually while in a code-review meeting where there's a flaw found or some other reviewer gave a -1
to the pull request for a minor change) which indicated the same. I had a close working relation with him and after couple of times hearing him, one day, I chose to reply him in a way he'd understand (spoiler: we both were GOT fans)
Death is so terribly final, while life is full of possibilities
Yes, we both laughed next, but somehow it affected him and gradually he stopped making those negative comments. Just saying. :)