library(sf)
## Linking to GEOS 3.5.1, GDAL 2.2.2, proj.4 4.9.2
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
# Query
dat = 
  opq(bbox = "Beer-Sheva, Israel") %>%
  add_osm_feature(key = "building") %>% 
  osmdata_sf()

# Get polygons
pol = dat$osm_polygons

# Plot
plot(st_geometry(pol))