It's never explicitly said in the film, but if we listen closely the apartment scene we can understand Marvin was their informant within that group.
Here is the script of the scene.
Jules - "We should have shotguns for this kinda deal." Vincent - "How many are up there?" Jules - "Three or four."
Vincent - "
That's counting our guy ?"
Jules - "Not sure." Vincent - "
So that means there could be up to five guys up there?"
Jules -
"It's possible.
"
When Vincent says "That's counting our guy" Marvin was their guy who's the informant.
After shooting Brett and the others, Vincent says to Jules, "
Do you know this guy?
" and Jules responds,
"Yeah" .
This is why they didn't shoot him.
movies.stackexchange.com/users/556/Vijin Paulraj
They did not kill Marvin because he was part of Wallace's network and was an informer in the gang.
Remember they asked "why didn't you tell us there was a man in the kitchen with a god damn cannon?"
or something like that.
This shows that they were expecting him to provide this info and logically he was their man (mentioned in the hallway).
If they had killed him then there would be little incentive for people to inform on gangs that had betrayed Wallace in the future.
This is also, probably, why Jules and Vincent are uninterested in the excuses
"You're ass ain't talking your way out of this" because regardless of what they say the hitmen know their true plan from Marvin.
movies.stackexchange.com/users/1501/Stefan
According to Phil LaMarr (actor who played Marvin), from his AMA (Ask Me Anything) post on Reddit /r/IAMA , it's because (emphasis mine):
The back story that Quentin and I talked about was that Marvin and Jules had people in common and when this briefcase thing went down Jules was able to get in touch w/ Marvin and offered these guys who were holed up, scared and obviously way out of their depth a way to resolve this .
"All you have to do is make sure the door is unlocked at 7:45." He didn't know exactly how it was going to be resolved and he wasn't street-smart enough to figure that the resolution might have a significant cost.
movies.stackexchange.com/users/1006/galacticninja
I think that marvin was his informant, but was going to try to double cross Jules and Vincent.
THAT'S why the guy was in the bathroom with a gun.
Jules himself says, we should be dead.
Divine intervention stopping the bullets?
That's why Vince gets so upset at Marvin for 'forgetting' that the guy was in the bathroom with a hand cannon.
Jules' attention is focused on that they weren't killed.
Later, divine justice is laid upon Marvin for his attempt at a double cross, when he gets shot in the face.
I think that, if Jules attention hasn't been distracted, they might have killed Marvin in the apartment.
Because of the total screwup.
Marvin was a nobody.
Signified by Wolf later, who described him as 'nobody who'll be missed'.
Just my opinion.
movies.stackexchange.com/users/41485/Tony rocky horror
Well for starters, Marvin was their informant and Brett, Roger (guy on the couch) and Man #4 (hand cannon guy, guy in bathroom) were the targets.
Man #4 could have survived if he had stayed in the bathroom.
Anyhow, Marvin was not purposely killed because he was ratting his fellow pencil-neck college students out so he could live.
A choice he later regretted ( as you can see when Brett is killed )
but due to Vincent Vega's poor gun safety skills, Marvin gets his head blown off.
Also the reason it all happened in the first place was because Brett and his friends refused to give up the brief case for whatever reason.
movies.stackexchange.com/users/4134/quention taranto
In Pulp Fiction, Vincent and Jules killed all the guys at Brett's apartment for stealing the briefcase from Marsellus Wallace but not Marvin.  Why didn't Vincent and Jules kill Marvin in Pulp Fiction?
Why didn't Vincent and Jules kill Marvin?
movies.stackexchange.com
<analysis><pulp-fiction>
movies.stackexchange.com/questions/3198
movies.stackexchange.com/users/556/Vijin Paulraj
They did not kill Marvin because he was part of Wallace's network and was an informer in the gang.If they had killed him then there would be little incentive for people to inform on gangs that had betrayed Wallace in the future.  Marvin was part of Wallace's network and was an informer in the gang. 
Marvin was part of Wallace's network and was an informer in the gang. If they had killed him then there would be little incentive for people to inform on gangs that had betrayed Wallace in the future. Jules and Vincent are uninterested in the excuses. Marvin and Jules had people in common  and when this briefcase thing went down  Jules was able to get in touch with Marvin and offered these guys 