Consider the topological spaces $X$ with the following property:
For every compact $K\subseteq X$ there is a compact set $L$ such that $K\subseteq L\subseteq X$ and $L$ is a retract of $X$.
Let us call this property RBC (Retract to a Bigger Compact). This property seems natural and useful, but I have been unable to find anything directly on it.
Using certain known results, it is not hard to see that every closed topological subspace of a locally convex metrizable topological vector space has the RBC property.
It is also clear that the RBC property is topological and thus invariant with respect to homeomorphisms. Trvially, any compact topological space has the RBC property.
Question: Can one characterize the RBC property?
That is, can one give a usable necessary and sufficient condition for it? Or a usable sufficient condition somewhat close to necessity? By "usable", I mean without the quantifier "there is" in the definition of the RBC property.
I do not know the answer even to this question: Is there an example of a topological space without the RBC property?
Thinking about the latter question, I have in mind the "non-retract" example of the $(n-1)$-sphere, which is compact but not a retract of the corresponding closed ball, whereas the ball is compact as well and of course is a retract of itself and of the corresponding $n$-space.
Update: The latter question has been answered in comments by erz, Anonymous, and Taras Banakh, who provided examples of topological spaces without the RBC property.
At this point, I would like to make the first question, to characterize the RBC property, more specific:
Specific question: Is it true that all Polish spaces have the RBC property?
My motivation for all these questions comes from probability. Indeed, any retraction $r$ from $X$ to a compact subset $K$ of $X$ naturally induces the truncation map $\xi\mapsto r\circ\xi$ of random elements $\xi$ of $X$, so that the truncated version $r\circ\xi$ of $\xi$ is a random element of the compact set $K$. Moreover, this truncation map is continuous: if $\xi_t\to\xi$ in distribution, then $r\circ\xi_t\to r\circ\xi$ in distribution.