The story is mentioned in UTTARA KANDA of Valmiki Ramayana, After defeating Vasuki and before the war with Varuna (or his sons), Ravana had a war with Nivatakavachas (Nipata seems their king) which was resolved by Lord Brahma himself.
And arriving at Bhogavati the city governed by Vasuki, he brought the Nagas under subjection.
And then, delighted, bent his course to the palace Manimayi There dwelt the Nivatakavachas", who had obtained boons. Those Daityas were possessed of prowess and endowed with strength, carrying various weapons, breathing high spirits and invincible in battle.
And the Danavas and Rakshasas growing enraged fell to raving each other with darts and tridents, Kulicas and axes and Patticas. And as they faught one entire year passed away and neither side obtained victory or was worsted.
And then that way of the triune sphere, that God, the undeteriorating Great father, swiftly presented himself on the scene mounted on his excellent car.
And making the Nivatakavachas desist from battle the ancient great father (Lord Brahma) spoke in clear words:
"Even the Devas and the Asuras are not able to vanquish this Ravana in battle; nor can the Danavas backed by the Devas can destroy you. Do you therefore turn your minds to making friends with the Rakshasa. All interests are forsooth the common possession of friends."
This was one of the special cases of boon conflicts as discussed in this post:
Is there any mention of boon deadlock in scriptures?
Thereat Ravana made friends with the Nivatakavachas in the presence of Fire ;and then rejoiced greatly. And duly honored (by them) Dasanana passed there a year, without any feeling of that place being different from his own home: and spent his time agreeably. And having learnt there an hundred sorts of illusion, he directed his course to Rasatala, searching for the city of the lord of waters.