My mother always told herself these things when I was a kid. The reality was that it was never this simple, and the more she tried to force the issue, the more I ran toward bad influences as fast and as hard as possible.
This girl is not a bad influence. This is a fallacy of responsibility for the problems your child is choosing to express. This child is a girl who is making choices your daughter is looking up to for some reason. You need to stay focused on what your daughter is reacting to in her overall life, which is making those choices seem appealing, and helping her learn to make her own choices no matter what her friend is doing.
You would be better off trying to help your daughter be a good influence on her friend, and understand why it's important to make the choices you value, and what the consequences are that she will face for all her options of choices, than to try to force anything. At the end of the day your child has a right to make choices. You need to be teaching her why some choices are better, what the risks and costs are with all choices, and how to evaluate them.
And you need to understand that she won't always agree with you. And you need to realize that she has a right to sometimes disagree. And it will drive her hard and fast toward the wrong choices to attempt to force things rather than help her reason through them and express disappointment when she chooses badly. Blaming it on this other girl makes her want to defend the other girl. Talking to her about her own path and values and why she respects what she does, has at least a chance of success.
If your daughter is making her own decisions based on the consequences she will face for them, and encouraged to learn to think this through, you will find that she will start to surround herself with people who also take responsibility for themselves, given time. And her self confidence will start to teach this way of being to others in her life as well.
Your question expresses a believed state of weakness in your child by saying any child can cause her to be something she is not choosing to be. Help her create an internal place of strength for herself which you and she both respect even when you disagree, where there is no illusion that she is too weak to decide on her own. Who knows, maybe the experience will have the added bonus of saving the other young woman by teaching her a new path in the process.