City attorneys said there is concern that people may be living in the warehouse at 219 N. Justine Avenue. The warehouse is not zoned for residential use.
WATCH: Timeline of R. Kelly sex abuse allegations
"If someone is living there and the property has not been converted properly to living space, it could create a safety concern if a fire breaks out or there could be a number of things that could go wrong," said Kimberly Roberts, an attorney for the city.
An attorney for R. Kelly said there was not an emergency and they would be happy to grant access in 30 days. The judge ruled in favor of the city, and an inspection will take place next Wednesday.
The judge's order names Midwest Commercial Funding LLC and the singer, whose legal name is Robert Sylvester Kelly.
"There is no truth to any of the specious allegations regarding that premises," said Melvin Simms, an attorney representing the building's tenant.
Some around the property on Justice said there have been efforts to get Kelly out of the area and say they've often seen young women coming and going from the building.
"We see a lot of traffic coming in and out. We see young girls, sometimes older girls. Parents dropping them off, ubers, cars. Limousines come and a bunch of girls come out, run in there screaming," said Melanie Rolon, who works in the area.
People who work in the area also told ABC7 Eyewitness News that they've noticed someone has put padlocks on the building's dumpsters in recent days.
'WE KNOW THOSE THINGS DIDN'T HAPPEN' - R. Kelly's attorney defends singer amidst allegations
The attorney for R. Kelly is firing back and defending the R&B singer who has been under fire since the release of a docuseries, "Surviving R. Kelly."
In the midst of an onslaught of allegation, R. Kelly attorney Steve Greenberg remains defiant.
RELATED: R. Kelly's ex-wife shares story of abuse, survival to help other women
"We know what happened and we know those things didn't happen," Greenberg said. "The man was not operating a harem or a sex cult or holding people hostage or anything like that."
Greenberg spoke with ABC News on R. Kelly's behalf for the first time since the release of the Lifetime docuseries.
ABC: "Do you know if he plans to have any legal action against anyone?"
Greenberg: "Well, hopefully he'll sue Lifetime."
ABC: "For what, defamation of character?"
Greenberg: "For defamation because people shouldn't be able to do this to someone."
RELATED: R. Kelly parties at South Side nightclub as legal pressures mount
And regarding those decades-long claims that Kelly is involved with minors...
ABC: Does he deny ever having a sexual relationship with someone who is under the age of consent?
Greenberg: "Yes, he absolutely does."
ABC: "Was he married to Aaliyah when she was 15?
Greenberg: "He was married to her when she was 15. Elvis was married to Priscilla."
ABC: "But so then 15 is not of the age of legal consent. Right? I mean."
Greenberg: "Except that my understanding is that she did not claim to be 15. And in order to get married she had to lie about her age."
ABC: "And he is saying that he had no idea."
Greenberg: "No idea."
Greenberg also responded to allegations made by the Savage family, who claim the singer is holding their daughter, Jocelyn, against her will.
Greenberg: "No one ever complained about anything until some producer came and found them."
ABC: "Well that's not exactly true because the Savages do have police reports that they've filed, right, saying that R. Kelly's former manager and current manager threatened them...and that's been documented by police."
Greenberg: "Well, so Mr. Savage, and I hate to dis used car salesmen, but as a used car salesman, who first made allegations and when he first made allegations, he had his younger daughter present a video blasting R. Kelly, saying she's going to be rap star. He's in this for his own personal gain."
WATCH: Kelly's estranged daughter speaks out against her father
All of this comes on the heels of Lady Gaga's announcing she has pulled her 2013 collaboration with R. Kelly, "Do What U Want" from streaming services.
"Lady Gaga did a song with him in 2013 and there were no problems," Greenberg said. "Now there were rumors about Mr. Kelly back then. What has changed between then and now? I'll tell you what's changed between then and now, she says if I don't disclaim my association with him, it might hurt my chance to get an Oscar. That's exactly what it is."
ABC NEWS contributed to this report.