You cannot change her and saying anything to her will only cause her to once more say "but". She has to want to change the way she looks at life before she can do anything to change.
You can tell her that you get depressed being around her. Be honest with the way you feel. Use I statements. This would be a natural consequence for the way she's acting and may, but it's not likely, encourage her to seek help. If you haven't already, do suggest that she see a counselor.
I would stop her when she's complaining by just saying something like, "I've heard that already. Lets talk about something pleasant." Then have something pleasant to say. I would also spend less time with her. You don't need to tell her you're going to spend less time unless she notices and asks. Just be not available. You need to take care of yourself, too. Don't feel bad for doing this. It's a natural consequence for her.
During the times you do talk with her I would be sympathetic for a brief period of time. I suggest than any effort to try to convince her that she's not a loser, etc. will only intensify her need to prove that she is a loser, etc.
She needs professional help to figure out why she feels so down and to learn ways of taking care of her needs so that she can be happier.