Former Barcelona player Dani Alves will remain in prison after a Spanish court denied his request to be freed on bail while a sexual assault accusation against him is investigated.