Robb had his doubts, but no proof. While the Northern Lords are discussing their alliance plans moving forward we see this exchange:
“You cannot mean to hold to Joffrey, my lord,” Galbart Glover said. “He put your father to death.”
“That makes him evil,” Robb replied. “I do not know that it makes Renly king. Joffrey is still Robert’s eldest trueborn son, so the throne is rightfully his by all the laws of the realm. Were he to die, and I mean to see that he does, he has a younger brother. Tommen is next in line after Joffrey.”
"Tommen is no less a Lannister," Ser Marq Piper snapped.
"As you say," said Robb, troubled. "Yet if neither one is king, still, how could it be Lord Renly? He's Robert's younger brother. Bran can't be Lord of Winterfell before me, and Renly can't be king before Lord Stannis."
A Game of Thrones, Catelyn IX
When Catelyn is sent as an envoy to treat with Renly (and eventually Stannis because he decided to attack Renly at that time) she is still unaware, but soon finds out from Stannis.
Stannis frowned at her. "You presume too much, Lady Stark. I am the rightful king, and your son no less a traitor than my brother here. His day will come as well."
The naked threat fanned her fury. "You are very free to name others traitor and usurper, my lord, yet how are you any different? You say you alone are the rightful king, yet it seems to me that Robert had two sons. By all the laws of the Seven Kingdoms, Prince Joffrey is his rightful heir, and Tommen after him... and we are all traitors, however good our reasons."
Renly laughed. "You must forgive Lady Catelyn, Stannis. She's come all the way down from Riverrun, a long way ahorse. I fear she never saw your little letter."
"Joffrey is not my brother's seed," Stannis said bluntly. "Nor is Tommen. They are bastards. The girl as well. All three of them abominations born of incest."
Would even Cersei be so mad? Catelyn was speechless.
A Clash of Kings, Catelyn III