You get it from talking to a grunt while they're at the museum, so if you go around him (If you get too close it automatically makes him talk to you.), and complete that part of the story so they leave, can you never get it?
All the other grunts will leave, but the one that gives you Thief will remain on the first floor until you talk to him. This means you can get Thief at any point.
One of the Team Magma / Team Aqua Grunts visiting the museum, the same one that the player had beaten in Petalburg Woods and Rusturf Tunnel, gives the player TM46 (Thief). The Grunt stays in the museum (even after the player defeats his colleagues on the second floor) until he gives the player the TM and runs off immediately after giving it to them.
Source: I've played every Hoenn game, and Bulbapedia
Hope I helped!