My heart goes out to both of you. I've gone through this kind of thing with my daughter also. First things first, if there are only 6 girls in her class, she is in a tough situation. I would talk to the school about addressing their gender inbalance problem in some way, maybe by having some sort of girls only activity where all 12 girls are put together once or twice a week. I would also ask the school to try to recruit more girls so the inbalance is not so stark.
The best advice I got for me and my daughter is to work to create positive experiences for both of you, so that neither of you focuses too much on her current difficulties. It sounds elementary, but sometimes if you obsess about it too much and she too, that becomes the story she runs in her head and if that is the loudest story in there, it will be very hard for her and it will not help her in the school yard or anywhere else. It will help if instead of thinking I have no friends, she is thinking about the neat play she saw or the hike she took or the flowers she planted. The positive outlook will help her with other kids as well.
Make sure that outside of school, she has activities she enjoys. Also encourage group activities, like the girl scouts, or if your school offers after-school activities at the school, church groups, choirs, theatre, neighborhood kids, cousins etc. - the key is for her to feel a part of as many groups as you can. As your daughter participates in a variety of group settings, she will not only gain experience, but she will relax and gain social resiliency so she can shrug off when a child is rude.
Finally, if you're worried that your daughter may be on the autistic spectrum or have some other learning difference that is affecting her socially, check out the Schwab Learning web site. The message boards are no longer open, but you can do searches in there for past conversations. The parents on that board are extremely knowledgeable and you may be able to figure out what you think about whether or not your daughter exhibits these tendencies. It is often difficult to diagnose girls with these difficulties and many are not diagnosed until they are much older, but that doesn't mean that they are not having difficulties earlier, it just means their difficulties are more subtle and difficult for the experts to catch. You know your daughter best, so trust your gut.