I think I would probably make p a dataframe, but this works too.
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
set.seed(15)
X <- 7.5
Y <- 7.5
f <- function(){
as.integer(runif(10,1,10))
}
onlineloc <- data.frame(x = f(), y = f())
plot(onlineloc, main = "Online and instore customer loc", col = "red")
points(X, Y, pch = 15)

p <- st_point(c(X, Y))
onlineloc <- st_as_sf(onlineloc, coords=c("x", "y"))
st_distance(p, onlineloc)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 6.670832 5.700877 2.915476 1.581139 3.535534 1.581139 2.54951
#> [,8] [,9] [,10]
#> [1,] 4.743416 5.522681 0.7071068
Created on 2019-09-14 by the reprex package (v0.3.0)