I'm not clear on your question, but I think that you may be trying to say that every point on the graph of $f$ is isolated in the plane. Is that right? In this case, we can associate to each point $x$ in the domain of $f$ an open ball inside your square containing $(x,f(x))$ and no other points of the graph, such that the ball has rational center and rational radius Since no two points on the graph can be associated with the same such rational ball, this means that our association is one-to-one. But since there are only countably many rational numbers, the number of such rational balls is countable, and so the domain of $f$ must be countable. Thus, we cannot do it with an uncountable domain.

What the argument shows is that if a subset of the plane has only isolated points, then it is countable.

Another possible interpretation of your question, based on what you wrote, is that you meant to speak just of the
*boundary* of the square, rather than it's interior. In this
case, it is possible to do it with uncountable domain. Let
$V$ be a Vitali set, which contains exactly one real number
in each equivalence class, where $x$ and $y$ are equivalent
if $x-y$ is rational. Define $f(x)=x$ for $x\in V$. Now
consider any $x\in V$. Note that $x\pm q$ is not in $V$ for
any rational number $q\in\mathbb{Q}$. So the square
centered at $(x,f(x))$ with side length $2q$ stretches from
$x-q$ to $x+q$ both horizontally and vertically, and
contains no points from the graph of $f$.