I don't think he was in the Room of Requirement when he received the letter.
But we were still fighting, doing underground stuff, right up until a couple of weeks ago. That’s when they decided there was only one way to stop me, I suppose, and they went for Gran.
Deathly Hallows, Chapter 29, The Lost Diadem (emphasis mine)
Neville is still fighting against the Death Eaters stationed at Hogwarts and has not completely disappeared yet when his gran is attacked. A couple of weeks ago can mean that the attack took place more or less than two weeks previously. Not necessarily exactly 14 days ago.
Neville's gran (Augusta) is attacked in an attempt to keep him in line. This attempt fails and the Carrows realise that there is no way to force Neville to submit, so they decide to kill him.
It had worked really well, kidnapping kids to force their relatives to behave. I s’pose it was only a matter of time before they did it the other way around.
“Yea,” said Neville happily. “Only thing was, once they realized they had no hold over me, they decided Hogwarts could do without me after all. I don’t know whether they were planning to kill me or send me to Azkaban, either way, I knew it was time to disappear.”
Deathly Hallows, Chapter 29, The Lost Diadem (emphasis mine)
Neville hides in the Room of Requirement while being chased by the Carrows.
The Carrows were chasing me, and I knew I had just one chance for a hideout: I managed to get through the door and this is what I found! Well, it wasn’t exactly like this when I arrived, it was a load smaller, there was only one hammock and just Gryffindor hangings.But it’s expanded as more and more of the D.A. have arrived
Deathly Hallows, Chapter 29, The Lost Diadem
And Seamus mentions the length of time they're been hiding out in the Room of Requirement
“So we’ve been hiding out here for nearly two weeks,” said Seamus
Deathly Hallows, Chapter 29, The Lost Diadem (emphasis mine)
Going from the timeline of the events that took place, it's entirely plausible that Augusta sent Neville the letter before he was hiding in the Room of Requirement. If you take a couple of weeks to mean more than two weeks, and people have been hiding in the Room of Requirement for less than two weeks, there are a few days in between where Neville can receive the letter normally before he starts hiding in the Room of Requirement.
The news that the attack on Augusta had failed wouldn't have necessarily traveled faster than her letter to Neville.
Taking into account the (possibly) only person sent to attack Augusta was Dawlish, who was injured so badly he's still in St Mungo's, there is plenty of time for Augusta to send a letter to Neville before Dawlish was found, sent to the hospital, and the Carrows realised their plan had failed.
The timeline (as I see it) would be something similar to this:
18 days ago: Augusta is attacked. She escapes and sends a letter to Neville by regular owl.
18 to 15 days ago: Neville recieves the letter. The Carrows realise they have to kill him.
15 days ago: Neville finds the Room of Requirement after being chased by the Carrows.
Today: Harry, Ron, and Hermione meet the rest of Dumbledore's Army in the Room of Requirement.