Nia Guzman, Chris Brown's baby mama, says one of her ex-friends is making death threats against her and Royalty ... so she's run to court for protection.
Nia filed a police report, and also requested a restraining order, against a woman named Shakur Sozahdah. In docs, Nia says Shakur is making criminal threats.
Sources connected to Nia tell us she believes Shakur wants to kill her and kidnap 3-year-old Royalty.
Also, Shakur recorded, and posted, a diss rap that squarely threatens Nia with lines like ... "I really hate this bitch / I won't take my foot off your neck / You lucky I love your little daughter like I do, do 'cause we woulda already run the f**k up on you, you"
In the social media post, she also accuses Nia of doing blow and having a "disease infested mouth."
Nia's request for a restraining order was filed Monday and granted. Shakur must stay 100 yards away from Nia and Royalty.