to be distracted / daydreaming
Similar to 'estar en las nubes'.
I didn't hear you, I was daydreaming.
—Did you hear me? —Sorry, I was daydreaming.