Actually, an electric guitar (or bass) pickup works by measuring the changes in the magnetic field around it by the metal vibrating strings. This is the same principle that most traffic light sensors use, except they use a large loop of wire buried under the asphalt instead of a pickup and vehicles instead of metal strings.

The pickup would work just as well in an airless chamber. The string would produce no sound, but the pickup would convert the change in inductance into an electrical signal representing the sound waveform just the same.