You can do this instead of using update_field()
:
update_post_meta($post_id, 'fieldname', $value);
update_post_meta($post_id, '_fieldname', 'field_' . uniqid()); // `uniqid() is a native PHP function. This is also how ACF creates the field keys
Also, depending where you are retrieving the value, you may also have to pass the post id.
the_field('fieldname', $post_id);