What do I do as a depressed and incompetent TA? My mental health is declining and as a result I haven't been a good TA.  For example I let my students out of section early because I was too tired to present some of the material, and I did not understand some of my section notes because another TA prepared them, and I didn't read them in advance.

I also have trouble helping students during office hours, and often ask students to repeat themselves, and I don't do adequate preparation (by reading the solution sets in advance).  I often don't know how to answer questions and I ask the students to collaborate with each other and solicit help from people who have already solved the problem.  I wasn't the best TA to begin with, but now that I'm depressed, I am basically useless, and embarrassingly so.

I feel pretty bad about this and I am also terrified that my students will complain to the professor, who is friends with my advisor.  What should I do?  I haven't told the professor or anyone about my diagnosis (of bipolar disorder).  And I am afraid to talk to the people at the school counseling center, because they might force me to take time off (this happened to me in college), and I can't really do that in grad school without irreparably burning bridges.
I utterly disagree with Mad Jack. You do not need to resign and by resigning, you set yourself up for a future where you will think of resigning every time you have a task that you do not think you will be able to complete to the high standards you set for yourself.

Try to disaggregate the two things -- the depression and the incompetence. If you are merely incompetent (or not as competent as you would like to be), read the rest of this answer. If your depression is putting you at risk to yourself or others (and will not be alleviated by acceptance that one cannot be competent at all things all the time), then perhaps Mad Jack's advice is warranted.

Now, about incompetence.

The reality is that you cannot be good at everything you do. Not all classes go well - even with the best of intentions. Sometimes, a class just fails. Sometimes it's your fault, sometimes it's the students, sometimes it's a combination. There are many classes that I've wished that I could have quit teaching halfway through.1

Sure, after you finish this semester your TA evals might be bad, they might be scorchingly bad. But that's ok. You fulfilled your obligation -- poorly, perhaps -- but you fulfilled them. The students themselves will recover. It's terrible that we can't all be always be stellar teachers, but we're human beings. You're just a blip -- one section of one of the 32 classes they take at the university. 

You've found out that teaching does not come naturally and that teaching is hard. This is a good life lesson. It's part of your graduate education.  You will get better at teaching the more you do it -- or at least figure out how to work around your incompetencies. We all do.

1. In the interest of full disclosure, I also struggle from depression and so this is written to you from the position of a peer. This advice is of course null and void if you at risk of entirely melting down. Your first duty is to yourself. But only you can know how close you are to endangering your own health for the sake of the class -- not anonymous internet peers.

Anecdote: I was forced to TA a class on a topic that I knew nothing about when I was a grad student. It quickly became clear that the even the most basic students knew infinitely more than I did about the subject. I was a terrible, terrible TA but my professor worked around me, the students learned to never come to my sections or office hours, and somehow we made it work. Now every time I get assigned a terrible TA, I believe it to be karmic retribution for my past sins. So talk to your professor. S/he may have also been a terrible TA and may be more than willing to work with you on this.

Finally, mood disorders like depression and bipolar disorder are not incompatible with academia. There are many successful academics with tenure (Kay Redfield Jamison and Emily Martin have both written books on their own experiences with bipolar disorder). Yes, during our trough periods things can be hard to do, but when the fog lifts we tend to be more productive. I've used that successfully to write two books, publish numerous articles, blah blah. Fortunately I'm at a university that allows for some umm ... eccentrism in the faculty body. I am three sigmas on that scale. :-)