What evidence do you have that it doesn't work? Provide some program output.
Regardless, I'm not convinced that the test you have done is valid. You don't treat the sensor the same way between setup() and loop(). After it has been initialized, the internal CPU in the sensor may not be reading the address pin.
Do a new test, in which you hard wire the address pin either high or low. Have the program address the device at either 0x28 or 0x29. Note that there is a BNO055 command to perform a system reset.