The issue here is that it is rather hard to provide a definitive answer because much about prophecies is left unexplained in the books. Most importantly, we are not told when, how, and by whom, the prophecies are "uploaded" into the Hall of Prophecy, nor are we told when, how, and by whom, the protections are placed on the prophecies.
There are essentially two possibilities: 1) It is an automatic magical process. 2) It is a manual process.
If it's a manual process then whoever is performing the process presumably chooses who will have the ability to retrieve it. In that case there are a number of possibilities. When the prophecy was first made, the second person it referred to was unknown so it would have been impossible to include him in the "allowed list". Once Harry and Neville were born, it is possible that the guy added both of them or it is possible that he added neither of them since he still did not know who was referred to.
Once Voldemort attacked Harry, it is possible that he added Harry under the assumption that Harry must be the one whom the prophecy referred to if Voldemort attacked him. Indeed, this is what Dumbledore in Chapter Thirty Seven of Order of the Phoenix said happened to the label on the prophecy:
“The official record was relabeled after Voldemort’s
attack on you as a child,” said Dumbledore. “It
seemed plain to the keeper of the Hall of Prophecy
that Voldemort could only have tried to kill you
because he knew you to be the one to whom Sibyll
If it's an automatic process there are still multiple possibilities. The automatic magic could likewise not have known who the second person was at the time of the prophecy. It is possible that it automatically added Harry and Neville when they were born, or it is possible that it added Harry after Voldemort attacked him.
We Don't Know
In either case, it is possible that Neville was added and it is possible that Neville was not added. It is also possible that even after Voldemort attacked Harry, the prophecy still could have referred to Neville. The fact that Voldemort attacked Harry doesn't mean that he couldn't also attack Neville (especially if, as Dumbledore claims1, there are many prophecies that have never been fulfilled). However, Dumbledore in Chapter Thirty Seven of Order of the Phoenix seems to have thought that once Voldemort attacked Harry the prophecy was necessarily referring to Harry:
“Then — it might not be me?” said Harry.
“I am afraid,” said Dumbledore slowly, looking as
though every word cost him a great effort, “that there
is no doubt that it is you.”
“But you said — Neville was born at the end of July
too — and his mum and dad —”
“You are forgetting the next part of the prophecy, the
final identifying feature of the boy who could
vanquish Voldemort... Voldemort himself would ‘mark
him as his equal.’ And so he did, Harry. He chose
you, not Neville. He gave you the scar that has proved
both blessing and curse.”
“But he might have chosen wrong!” said Harry. “He
might have marked the wrong person!”
“He chose the boy he thought most likely to be a
danger to him,” said Dumbledore.
As I pointed out above, this is not necessarily a compelling argument. It is possible that the person or process in charge of protecting the prophecies did not agree that it was certainly referring to Harry.
Since Neville never attempted to retrieve the prophecy, we actually don't know what would have happened had he tried. For all we know he was able to retrieve it.
1. As he stated in Chapter Twenty Three of Half-Blood Prince:
"If Voldemort had never heard of the prophecy, would it have been fulfilled? Would it have meant anything? Of course not! Do you think every prophecy in the Hall of Prophecy has been fulfilled?"