Knowles had been working on her second studio album on and off since 2005 following her return home to Houston Texas and her divorce from Daniel Smith with whom she had lived following the birth of their son Daniel Julez in October 2004 .