I think that would be "Pałac jest naprzeciwko rynku/targu." (Maybe using 'targ' instead of 'rynek' here, as I think 'targ' has more of a grocery market feel as opposed to 'rynek' which is more of a communal town square.)
Why is 'Near' wrong and 'by' is preferred? Dictionaries say 'near' is fine.
Because Duo is very particular about this stuff and 'blisko' is probably near as far as it's concerned.