This is really something you need to sort out for yourself.
If your still pretty decent friends with the girl, then you should be by her side in her hour of need; and your girlfriend should understand that you need to be there for your friend regardless of whether she's an ex or not.
It sounds like she doesn't have much left at the moment, and having a friend turn up as a shoulder to cry on would be a very good thing for her.
I can understand that your girlfriend doesn't want you to see your ex, and this is a difficult time for everyone concerned. But nobody has the right to dictate somebody else's life and tell them they can't see another person.
As a friend, you need to be there for her.