You can small single pallet, pallet racks under the storage locations of each pallet and then dynamically change them to obstacles using setObstacle(isObstacle)
if you place a pallet in that location.
If they make the animation look weird you can set their visibility to false.
If you have lots of places to place pallet you can also create these dummy pallet racks programmatically using
palletRack = new PalletRack(this, SHAPE_DRAW_2D3D, true, true, 130.0, 230.0, 0.0, 20.0, 20.0, 20.0, 50.0, 0.0, PALLET_RACK_SINGLE_AISLE_RIGHT, PALLET_RACK_NO_DIRECTION,
0.0, 40.0, 20.0, 1, 1, 1, lavender, dodgerBlue, 2 );
Check the help for more details on the constructor
Since this can be cumbersome to handle I can suggest the following - have not tested it but it should work - create your dummy pallete rack everytime you store a pallet

You might need to add it to the presentation using presentation.add(palletRack)
and remove it again.
Else what I would do is simply create a map of all the possible pallet locations and create a dummy pallet for each location and then when you store the pallet the pallete checks it location and simply looks up the correct dummy pallet from the collection and call setObstacle(true)
. When you remove it from the palette rack you set it to false...
If you want to use free moving transported the only way to have obstacles being switched on or off is with the obstacle characteristic AnyLogic created.