B.M.
Yep - time to back off. This is a phase for some kids, and for your daughter it's exacerbated by some tough stuff that she's figuring out how SHE wants to deal with it. She's putting up a boundary between you and her life. It's a tough stage - for both of you.
It won't get worse, unless you pick at her until you drive her crazy. Instead, give her some space. 2nd / 3rd grade is a huge time for figuring out who they are... friends are more important than ever. She will probably start to show interests in things she never did before (like, all of a sudden wants to play soccer when before... just played the flute etc). She's just now noticing there is an entire world out there.
Sometime around 5th grade she'll come back. You'll just be sitting on the couch one night watching sponge bob and out of the blue she'll come into the room and lay down beside you and put her head on your lap.
Until then give her some space.
The girl saying inappropriate things in 2nd grade is nothing that your daughter can't handle. It's the girl DOING inappropriate things in 10th grade when you want your daughter to be able to come to you. Let her figure out it is easier to have you to talk to than for her to wish you'd leave her alone.
Start having conversations that are not threatening to her and don't invade her space and her world. Like, in the car. Or while you guys are fixing dinner... times when you aren't making eye contact and she feels like you aren't the Spanish inquisition. Ask her opinions on things - let her help make decisions if you can - you decide the veggie tonight or whatever.
If she hasn't had sleepovers yet - now is a GREAT time to let her start having them - at your house. So you get to know her friends.
Hang in there!