"I eat outside the restaurant."
The difference when で indicates a location, is that it indicates the location something takes place, where as に is used for the destination of a motion verb (when referring to a location using に).
レストランに行きました - She went to the restaurant. レストランで食べました - She ate at the restaurant.
The general rule is for verbs such as あります, います, 行きます, たちます, すわります, に is used for location. For verbs such as たべます, よみます, ききます, で is used, but they do often overlap each other in particular contexts.
Then the sentence would read "I eat at the restaurant of outside" which sounds disjointed. Remember to use the pattern a の b to say b's a. E.g. 私の兄 (brother of mine; my brother).
Someone correct me if I'm wrong, but I think it's to show possession. Instead of "outside the restaurant" it's more like "the restaurant's exterior".
の makes the prior noun possessive. So it turns "restaurant" into "restaurant's" or "of the restaurant". Making the sentence "I eat outside (of) the restaurant"
の typically represents possession of something, for example 私の名前 is My name. It this context の is used for 'outside' as it belongs to the resturant in a way. It is the restaurant's outside area is a way to think about it I guess. I hope this helps and isn't too confusing