The same thought process as in that of the derivation for the 3D case can be used. However, you should note that in 2D there is no such thing as volume. You should use instead area, whenever the corresponding physical quantity in 3D space is volume. In the same way, area in 3D is substituted by length in 2D.
For example, say I have a 2D container, so basically in a rectangle. The equation of state becomes $pA=nRT$. You can see here that the pressure doesn't have the same unit as in 3D space but you shouldn't worry about that. It becomes Newton/meter, and that's dimensionally correct in this 2D world.