If we are all rotating with the same speed in one reference frame as the surface of earth with the pendulum.
We are all rotating with the same speed in one reference frame as the surface of the earth. But the pendulum isn't. That's why Foucault's pendulum works.
As the pendulum swings, from it's perspective it is swinging freely in an inertial reference frame. While the pendulum bob may be constrained to rotate with the local rotation of the earth*, the upper end of the pendulum is suspended on a mount that lets the cable pivot around a point in any traverse direction. So the swing of the pendulum is free to do it's thing -- and what it will do is to follow a trajectory that does not rotate in its inertial frame.
Basically, the pendulum is across a vertical axis, and does not rotate in inertial space about that axis. So it is insensitive to rotation in the ground underneath it which are parallel to that axis**.
In essence, this makes the Foucault pendulum into a really big, heavy, and awkward version of a vibrating-arm gyroscope -- and we know vibrating-arm gyroscopes work, because that's the basic technology the MEMS gyroscopes you find in cell phones***.
* Depending on how it's suspended, but I think mechanical sanity demands that it be suspended thus.
** Which means that how fast a Foucault pendulum's axis appears to rotate with respect to the earth is dependent on your longitude -- if you're at a pole, then it'll complete one rotation in 24 hours. If you're at the equator, then to a first order approximation it won't rotate it all -- although, it'll probably actually wander a little bit. If you're somewhere in between -- it'll be somewhere in between.
*** There are also quartz MEMS gyroscopes that are orders of magnitude bigger than cell-phone MEMS gyroscopes (but orders of magnitude smaller than the Foucault pendulum you may find at your local science museum).