Good for you. You did EXACTLY what you should have. You tried to help a little girl with problems. You did everything right. That poor little girl can't help the sad fact that she was born into terrible circumstances.
Obviously, you tried, as you should have, but it is not going to work. The bad influences on this girl are too strong. I have helped and tried to help many kids over the years, and sometimes it works, and sometimes it doesn't. But that doesn't mean that you should not have tried. So be proud of yourself for doing the right thing.
The way to help your daughter is simply to 1) listen to her and tell her that it is sad that the friendship is not working out and 2) to tell her that it is also very sad that this girl comes from such bad circumstances, that when a child grows up in such a family (drug addiction, etc.), the child is usually messed up and has bad behavior.
In other words, you tell her the truth about the girl's situation. My daughter has had friends from bad backgrounds, and when all our efforts couldn't change the child, I just told my daughter that it was to be expected.
You sound like a great mom, and your daughter sounds like she is being raised very well, so I would not worry about her doing the wrong things just to "keep up." I never limited my daughter's friendships with these girls, and my daughter has always done the right thing. I think you can probably trust your daughter, even though it's a moot point now.
Don't be angry or take it personally-- these are damaged people you were dealing with -- just be proud of yourself for being a good person and doing the right thing.