I seem to recall this one working in 3D:
http://www.mathworks.com/matlabcentral/fileexchange/24616-kmeans-clustering
If you have a 3-D matrix, I'm guessing that two of the indices can be combined to give a single index which selects a vector, and the third is the index into the vector. For example, if the data are vector measured at each pixel of an image, then often the first two indices select the pixel and the third selects an element of the vector. Then you could do something like this to conflate the first two indices:
[m, n, d] = size(imagedata);
N = m*n;
X = reshape(imagedata, N, d);
Then after calling your kmeans function you'll need another reshape to get the 1-D vector of cluster assignments back to 2-D.
You'll have to work out the details for your particular case though.