Subspace

Subspace is an extradimensional space which can be used by Transformers to store things.

Binaltech
The Japanese booklet for the Binaltech Smokescreen GT toy includes the following text: "The 'life force' that is the source of a TF's life is propagated through its entire body by a 'laser core,' which is at the center of a force field. The GT System separately contains this laser core outside the body in subspace storage, and by synchronously connecting with translink ports installed on each BT terminal, it is able to breathe life into each of the multiply duplicated personality data."

While this description is mostly technobabble, it does make clear that subspace can be used to store parts of a Transformer's body, yet still allow those parts to retain a connection with the rest of the body in "normal" space.

Fanon
The idea that Transformers can store equipment or portions of their body in an extradimensional space has been popular in fandom for decades. Most famously, in the original cartoon, Optimus Prime's trailer will often conveniently slide into the frame when he transforms to truck mode, thus suggesting either A) that it is constantly following him around, but carefully staying where the camera couldn't see it, or B) that it appears out of subspace. In Beast Wars, characters would draw their guns by reaching behind themselves, and then bringing their hands forward, now holding a gun, despite the fact that any shot of the characters' backs did not show a rear holster or anyplace to keep a weapon. Where did the guns come from? Subspace. This concept also figures prominently into many fanon explanations of size changing.