When doing L2 stuff, it's responsibility of device sending frame (can be originating host, can be router) to find out destination MAC address. And L2 entity (switch) then passes frame to correct port. If sender doesn't know destination MAC address, it can send it to broadcast MAC address. Both when destination MAC address is broadcast or if switch/bridge doesn't know exact port where destination is, it forwards frame via all ports (minus ingress port).
When doing L3 stuff, sender (and intermediate devices) need to determine how to deliver packet over L2 network. If destination IP address is within same network as sender is, then packet will be delivered directly (and sender looks up MAC address of final destination). If destination IP address is outside own network, then it has to consult routing table (which ever applies) and selects best next hop. Then it looks up MAC address of next hop and sends frame to next hop. More or less the same happens on router (it receives frame with own MAC address, looks at destination IP address and decides how to forward it toward final destination; in case egress interface is ethernet it also performs discovery of next hop MAC address).
If sender doesn't know destination IP address, then it may decide to send it to broadcast IP address or multicast IP address. These two are then directly mapped to broadcast MAC addess.
So for sensible network operation it should always be possible to send data to correct MAC address and for that all devices have to properly support
ARP protocol, without it modern local area networks simply die.