PhD student with mental health issues and bad performance
Be forthright with the student about what they are facing. Explain the various contingencies. They may be unaware or ill-informed. You could ask them which path they would prefer you to take... True, they may not be the best judges of their own best interests, or may not be able to act, but you can ask.
In particular, probably you indeed should not share information that you'd promised to keep confidential, short of issues like potential self-harm or harm-to-others. At the same time, it may be that your university has fairly strong guidelines about your supposed responsibilities in a situation like this. At least try to read up on them... whether or not you think it is humane or wise to comply. I suggest that you keep in mind that the university will be "covering itself" legally, first of all, with concern for students and faculty somewhat subordinate... so it is non-trivial to see what the truly best action will be.
In any case, I think it would be good to avoid allowing a disastrous thesis defense to occur, especially if there is no room for a second attempt (as at my own university). Being late but doing ok is vastly preferable to being on time and catastrophically failing...
No, I do not mean to suggest that laying this out for the student will magically transform them... but that it is fair to inform them of consequences of this and that, and ask them what route they'd want you to take.
And, by the way, is "removal from the program" merely (!?!) loss of funding? In my university, it is possible to continue to register (after everything but thesis and defense are done) without cost... and, thus, without necessarily having financial support from the program.
It can be incredibly difficult for a student to discuss any sort of health issue with his/her advisor or committee members and yet doing so can make all the difference.
Personally, I left my PhD program after two years rather than discuss my ongoing health problems with my advisor. I deeply regret that decision. I knew my advisor and committee were unhappy with my progress and I simply could not bring myself to talk to them about the health issues which were behind my lagging performance. By opening a dialogue with your student you may be throwing them a lifeline, a chance to open up and communicate about the relevant issues and find a solution.
To this day my former advisor has no idea that I was, and am, seriously ill and struggling with debilitating health problems. I "lose" at least one full day per week to illness. In graduate school losing a full day every week was a substantial liability. I am considered legally disabled and yet never shared that information with my advisor or department because I was scared about how they would perceive me and how it would affect my career.
Last year I finally received my M.S.(but sadly no PhD). The only way I was able to do that was to work with my university's student disability services office. Does your institution have an office for disability services? I would strongly encourage your student to seek their assistance and you may also want to consult with them and seek their advice on this issue.
As someone who was the student in a similar situation, I can speak from personal experience about what I wish my advisor and program had done (what they actually did will be omitted here to protect the guilty). My experience was in the US, so there may be some differences elsewhere.
If you are debilitated by a condition that impairs your intellectual functioning, it is difficult if not impossible to think clearly about the future and make good decisions. The student is evidently aware that things are not going well--as I was--but may not have the physical or emotional resources to be able to seek out options and plan ahead. This is compounded by all of the usual emotional stress and guilt of underperforming in grad school. The fact that the student brought it up to you is a cry for help, and you are doing the right thing by trying to act in the student's best interest.
Although it might be the case that the student really does not want to finish the degree (or isn't "PhD material"), it's impossible to tell as long as the student is sidelined by disability. So your first responsibility as their advisor is to protect the student from any future academic consequences for failing to perform now. This may involve your school's disability office, who might have standard accommodations for this situation. It may also involve working with the department to ensure that the student's current performance is not used as a justification to penalize the student if they later resume their program.
Your second responsibility is to do what you can to provide the student with some options to take a time-out and recover so that they can function well enough to make a good decision about when and whether to resume their program. From what you've said, the student seems to be dependent on the university for their living expenses and possibly also their healthcare as well. If this is the case--especially if you believe that the student would have difficulty finding or holding a job--the humane thing to do would be to offer some options so that the student can still be employed by the university and continue to have access to healthcare.
I emphasize that the student's health issues are ultimately their business and their responsibility. But since the student entrusted you and your program with their academic future, I believe that as the student's advocate in the academic world, the advisor has an obligation to protect the student in a situation where they are unable to fend for themselves.