That sort of depends on how "unsecure" the computer is.
If we take the worst-case scenario, then you should simply not use that computer.
If we leave out any hardware and BIOS hacks (this is espionage-grade stuff), then it would be safe to boot that computer from your own media like a CD or a USB disk to get into a safe OS. Mind you, a hardware keylogger is nothing more than a small adapterish thing that you can order online for $100 - no brains required! Always look behind a suspicious PC and make sure the keyboard cable runs in one piece.