Where is it stated that you cannot attach the racks to the building?
A pallet rack must be self-supporting. Avoid attaching racks to building structures, unless the building was designed for this purpose and it was approved by an engineer. If you must absolutely attach it, you need to make sure that the forces transferred to the building do not exceed its capacity and that the requirements of the National Building Code are respected. Here is an excerpt from the Canadian rack design code. The American code offers a similar answer.
Excerpt from: CAN/CSA A344.2-05 Standard for the design and construction of steel storage racks:
12 Interaction with buildings
12.1 The connection of storage racks to buildings, or to other structures other than the floor, is not recommended. Where such connections are made, the engineer(s) responsible for the rack, buildings, or other structures shall provide for their interaction.
12.2 Where connections are not made, storage racks shall be located so that the building and racks do not collide due to the design seismic forces.
12.3 Storage racks located at levels above the grade elevation shall be designed to resist design seismic forces that consider the responses of the building and storage racks as a combined structure to seismic ground motion.
Note: Storage racks and buildings have inherently different dynamic behaviours. Accordingly, any interconnection of the two will invariably lead to force transfers between them. In seismic events, the transfer is almost invariably from the high drift rack to the low drift building. Given the enormous mass disparity between them, such connections require either careful design or provisions to defeat any force transfer at all by maintaining a proper separation.
To read more on the subject: Recommended Clearances Between Pallet Racks and a Building's Structure