"foo" is a metasyntactic variable, used in the NetHack context to represent in a larger statement a word that can take on several values. The most well known of these uses is foocubus (to represent a succubus or incubus), though footrice is also common.