For simplicity let us limit ourselves with 3D and scalar functions. In this context "function defined on a sphere" means that you define the way to correspond a number to each point of the sphere. In mathematical terms it is easier to write using spherical coordinates $\theta$ and $\phi$ (radius coordinate is irrelevant here, as all points of the sphere would have the same radius value). So if you have function $f(\theta, \phi)$ defined on $\theta \in [-\pi/2, \pi/2]$, $\phi\in[0, 2\pi[$ this would be the function defined on the sphere. For example, $f(\theta, \phi)=sin(\phi)cos^2(\theta)$ would be such a function.
Note, that if you want you function to be continuous on the sphere, without 'seam' at $\phi=0$ you should impose condition $f(\theta, 0)=f(\theta, 2\pi)$ (provided your function is defined for $\phi=2\pi$).
Also, as $\theta=-\pi/2$ and $\theta=\pi/2$ correspond to 'north and south poles' of the sphere there should be another condition to avoid singularity there: $f(\pm\pi/2, \phi)=f(\pm\pi/2)$. It means, that function should not depend on $\phi$ at the sphere's 'poles'.
You may define you function in 3D Cartesian space, but then the domain constraints would be more complicated:
$f(x, y, z | x^2 + y^2 + z^2 = 1)$
meaning that function should be defined only for such $x, y$ and $z$ which correspond to unit sphere's surface. It does not mean that it cannot be defined for other points in 3D space, of course, but we are interested only on those on the sphere.