This happens in spectra. By [a theorem of Lin](http://www.ams.org/journals/proc/1976-056-01/S0002-9939-1976-0402738-5/), there are no maps from the Eilenberg-MacLane spectra $H\mathbb{F}_p$ to finite spectra; the proof is an Adams spectral sequence computation using the fact that the Steenrod algebra is self-injective. For a more algebraic example, let $A$ be ring containing an infinite regular sequence $(x_0,x_1,\dots)$ and let $M=A/(x_0,x_1,\dots)$. We can resolve $M$ by an infinite Koszul complex and compute that $\operatorname{Ext}^*(M,A)=0$. It follows that in the derived category of $A$, there are no maps from $M$ to compact objects.