My first reaction was naturally to go with "on a squash court" but a squash court is an enclosed court so saying "in a squash court" doesn't sound incorrect either. But it might be. An example I'm using to make me think "in a squash court" is fine is that a fish lives "in a fish tank", not "on a fish tank."
Use of prepositions in English is frequently idiomatic.
In your example "fish lives in a fish tank"-In tells us the noun is in an enclosed space (surround or closed off on all sides). Basically, when something is inside something.
- In a box
- In a room
- You probably couldn't get an aircraft carrier through there, but my kayak would have looked like a peanut in a squash court.
Consider the following:
All of the floor-markings on a squash court are only relevant during serves.
On tells us that the markings are located on a surface.
- On the table.
- On the floor.
In is for containers, and contents of containers.
On is for surfaces, and locations with respect to surfaces.
If you think of it as playing in a container, use in.
If you think of it as playing on a surface, use on.
This gets asked quite a lot here. And answered.
Since the walls and ceiling (as well as the floor) of the squash enclosure are used in play, it follows that the court is defined by the whole enclosure. In contrast, a tennis court consists of the two dimensional playing surface underfoot plus the perpendicular plane segment of the net. It thus makes sense to refer to playing "in a squash court" but "on a tennis court."
A conceptually more challenging situation involves indoor volleyball. The normal (indeed, universal) wording in this case is "on a volleyball court," but if you've ever played a reasonably hard-hitting game in a gym that has a low ceiling, you have undoubtedly encountered the problem of balls zinging up to the ceiling, hitting it, and coming straight down. Whether you treat such contact with the ceiling (or with nearby walls) as incidental contact or as removing the ball from play and ending the point, it is clear that the ceiling and walls are not intended to be strategic parts of the court. As a result, "in a volleyball court" doesn't sound right—even if the available space sometimes feels as constricted as a squash court.
It is colloquial usage:
"We play tennis on a tennis court, but we practice law in a court of law."
Verbally we treat a tennis court as a surface and a court of law as the interior of a building.
I think that to employ the number of surfaces as the determinant is a bit concrete (pardon the pun) whereas some of these conventions are more abstract. I must say I have never heard "in" used in respect of squash or fives courts (except when talking a\bout whether the service is "in" or "out". Racketball uses the same courts (and mostly rules) as squash. Raquetball is different.
I like the distinction between types. Courts as tribunals attract the preposition "in". Courts as loci of royal power use "at". Courts as sporting venues use "on".
An exception seems to be when we talk about a person visiting the locale where these games are played when he or she is "at the court(s)".
Another exception is the description of different parts of the playing surface, especially during service. e.g. "landing 'in' the opponent's quarter court"[squash] or "dropping 'in' the receiving court"[real Tennis]. Also, many of these sports talk about 'off-court' officials, presumably to distinguish from the 'on-court' players.
The roof in a squash court does not quite explain why "in" should be preferable. If we play "on" roofed volleyball, basketball or fives courts, why should squash be different? I must admnit, I haven't heard people talking about playing in squash court. The roof of a squash court is actually out of bounds as is that of volley ball and Racket ball courts - but not raquetball courts where the roof counts. Outdoor racquetball only has 3 walls and no roof!