a) He continued to mark his papers when student Sarah entered the room.
Without the context of say: *his favourite student or a specific description such as the student with the red hair can commas be omitted?
If we just say they are in apposition and require commas that doesn't account for the context or how many students are present or are not? As written, I'd assume he has the one student Sarah, but some may suggest they are in apposition and require commas and Sarah is parenthetical.
Something like: The dog, Charlie, chased the cat.
No context can changed and there is no ambiguity, but in a) the commas may change how the sentence may be interpreted.