Why can't I assign pin 18 on Lattice MachXO2-256-HC FPGA in my design?
The pinout files for your device can be found here. Based on the "MachXO2-256 Pinout" document, looking at the TQFP 100 package ("TG100" from part number):



We see that Pin 18 is a No-Connect pin.



Looking further, did you read "18" from the "PAD" column? (That would be PL5B). That corresponds to pin 17 of the TQFP package, not pin 18.