If you're in England you can write an advance directive saying that detaining you under the act would be harmful, and you can work out who your "nearest relative" is and make sure they say to the AMHP "I object to the section". These don't make it impossible to hospitalise you, but they do make it much harder.
But, importantly, you deserve help. And you don't need to disclose suicidality. You can just say that you feel very low, that you feel desperate.
There's good evidence that cognitive behaviour therapy is effective for about 60% of the people who use it. You may want to think about combining it with medication.
Additionally, there is a big difference (in my opinion) between suicidal thoughts and actually acting on those thoughts.
Just from reading your post it doesn’t sound like you have much to worry about.
It’s when ideation proceeds to having a timeline and decision to die by suicide is when hospitalization is absolutely necessary. At the end of the day, if I a person wants to die by suicide, there is very little anyone can do about it.
What matters is for you to talk.
Why would anybody not deserve to be alive? Life is fundamentally nonsensical, and our struggle / cross ( depending on how you see it ) is to put meaning into it. This is why life is at the same time a tragedy and a liberating experience.
We are ephemeral, and not this important at the individual level. Only thing that matters is not harming others, eventually doing good to others if we are lucky, and finding joy in little things ( intellectual endeavours, earthly pleasures, art, sunsets, you name it ).
If it can help, a reading that helped me when I was deep in depression in my 20's was the The Gay Science, by Nietzsche. Don't read it in one go. Keep it with you, and read a few aphorisms every day. Some three liners aphorisms from Nietzsche made more impact in my life than everything else I read combined. This book literally saved my life.
a good therapist will not hospitalize you
In the USA, anyway, a therapist is legally required to intervene if s/he sees the patient as a threat to harm himself or others.You can't get things prescribed this way. But it doesn't sound like that's an issue here.
People can be suicidal - can have suicidal ideation - without having an active plan.
Thoughts of "I feel trapped", "I feel hopeless" are red flag signs even if the person doesn't have a plan at that moment.
It's probably a good idea to remember that bad advice about suicide can cause death.