Use a fifo (a named pipe) instead of piping stdin directly!
mkfifo text.txt # create fifo
echo 'foo bar' > text.txt & # pipe data to fifo, in background
zip --fifo file.zip text.txt # note the `--fifo` argument to zip
rm text.txt # cleanup
Result:
$ unzip -l file.zip
Archive: file.zip
Length Date Time Name
--------- ---------- ----- ----
8 2020-11-29 12:30 text.txt
--------- -------
8 1 file
Note that the fifo is a pipe, no data is stored on your hard drive, it is streamed just like "|
" (an anonymous pipe).