It's clear from what you described that you're in a bad place in life and your suicidal tendency/ideation is a result of (putting it lightly) feeling unsatisfied with what life is for you at this point in time. I hate how simplistic and patronising professionals are about these things so I get why that got under your skin. They deal with a wide spectrum of the population. Most of which fit into a majority that doesn't give professionals much inclination to credit anyone with the common sense you or I may deserve. It's a bit ignorant on their part but I also feel like humanity let us down a bit there too. There's only so many times you can give benefit of the doubt and be proved wrong before you just assume everyone is an idiot. Anyeay, getting back to the point, I think what you need is something to look forward to for one thing. That can be anything and obviously is dependent on what's important and of value to you but whatever that may be try to find it even if it's just in small shit like eating nice food, gaming or watching movies etc or having relationships and interaction of one kind of another. I think having small island of solace through the days is essential for having any quality of life and if everything is shit you just spiral and naturally have fuck all to live for. All pretty obvious stuff so I hope I'm not patronising you the professionals did. Exercise can only do so much if you're not fulfilled on a more substantial level but only you can know what that would entail. Chase that down. I feel like maybe at this age you feel like it's a bit late to play catch up and you may feel you'll never find your way to reaching goals that once seemed to be within grasp and that's hard to deal with. A certain amount of acceptance may be required to manage that but "settling" doesn't have to be settling. Tastes can change and there's a variety of things that can fill a hole. Finding them isn't always hard but can be so I think getting out of your comfort zone and just being open to trying things you're not immediately drawn to can actually be pretty eye opening and revelatory. I'm not saying go sky diving or grow a massive mustache and become a human toothbrush or anything though. Just like search out some new shit online to give your head a tweak but also find a nice comfort zone you can retreat to if you can.
I guess with divorce there's still ongoing shit to deal with on top of the other life shit. I think a healthy way to deal with that (or maybe not lol) is to look at it like the day job and get it done and out the way then drop it and leave it to the next day rather than taking it home with you. I think that's healthy if you can do it but I'm not sure. It worked for me when I had my health.
Are you on meds or in any treatment? I don't want to tell you what to do on that front. I'm not qualified. However as a human also, I do feel it's important to remember life is life and relying on pills that change brain chemistry to deal with problems that don't originate in the brain but are rather reflected by it, is an illogical and potentially more problematic crutch to lean on that change and adaptation. I fear doctors aren't so considerate of that when doling out the pills and will do so with gay abandon much of the time. Usually without any warning of what you're going to go through when the time comes to stop using them. Unless they're a narcotic in which case expect more potronising ha.
Hope you find you way out of the ideation in a way that comes naturally and lasts! Good luck with it man.