Messi was denied by goalkeeper Diego Lopez in the 62nd minute after a foul on Sergi Roberto.
Espanyol's Oscar Melendo then slotted home with two minutes left after racing onto Marc Navarro's cross.
The second leg takes place at the Nou Camp on Thursday, 25 January.
In the other quarter-final ties, Diego Costa scored his third goal in four games during Atletico Madrid's 2-1 defeat at home by Sevilla.
Costa put Atletico ahead in the 73rd minute only for goalkeeper Miguel Angel Moya to inexplicably push a speculative cross that deflected off defender Lucas Hernandez into his own net.
New Sevilla coach Vincenzo Montella then sealed his third win since arriving in Spain as Joaquin Correa raced on to Wissam Ben Yedder's pass before finishing with two minutes remaining.
Goncalo Guedes and Rodrigo scored in the second half as Valencia came from behind to record a 2-1 win over La Liga strugglers Alaves.